/**
 *
 * @param table {Table}
 * @param auth {boolean} 接口是否需要鉴权
 * @param uninstall {boolean} 是否在生成代码时注释该方法，用于备用
 * @returns {string}
 */
const importPackage = (table, auth = false, uninstall = false) => {
  const {
    pkg,
    modeNameLowerCase,
    names: {
      TabName,
      JavaName,
      pkgName
    }
  } = table
  return `
import ${pkg}.business.${pkgName}.dao.${modeNameLowerCase}.*;
import ${pkg}.business.${pkgName}.entity.*;
import ${pkg}.business.${pkgName}.dto.*;
import com.querydsl.core.QueryResults;

import com.support.mvc.entity.base.Page;
import com.support.mvc.exception.DeleteRowsException;
import com.support.mvc.exception.UpdateRowsException;
import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import com.support.mvc.entity.validated.*;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.util.CollectionUtils;
import javax.validation.Valid;
import javax.validation.constraints.*;
import javax.validation.groups.Default;

import java.util.*;
import java.util.stream.Collectors;

//import static ${pkg}.config.init.AppInit.getCacheManager; // 若使用缓存需要解开代码
`
}
export const importPackageOpenInstall = table => importPackage(table)
export const importPackageOpenUninstall = table => importPackage(table, false, true)

export const importPackageAuthInstall = table => importPackage(table, true, false)
export const importPackageAuthUninstall = table => importPackage(table, true, true)
